package com.sys.middleware.hbase.test.model;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;

public class BImage implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3921103957639690797L;
	/**
     * 用来生成HbaseRowkey
     * 图片rowkey生成规则为:下划线域名#DOCId
     */
    private String _id;
    /**
     * 上传后图片地址
     */
    private String imageKey;
    /**
     * 上传后图片地址
     */
    private String imageURL;
	/**
	 * imageKey
	 */
	private String sourceKey;
	/**
     * 源图片地址
     */
    private String sourceURL;
    /**
     * 图片状态
     */
    private String status;
	/**
	 * docId
	 */
	private String DOCID;
	
	/**
	 * 平台id
	 */
	private String platformId;
	
	/**
     * 站点域名
     */
    private String domain;
    
   

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getSourceKey() {
        return sourceKey;
    }

    public void setSourceKey(String sourceKey) {
        this.sourceKey = sourceKey;
    }

    public String getSourceURL() {
        return sourceURL;
    }

    public void setSourceURL(String sourceURL) {
        this.sourceURL = sourceURL;
    }

    public String getPlatformId() {
        return platformId;
    }

    public void setPlatformId(String platformId) {
        this.platformId = platformId;
    }

    public String get_id() {
        return _id;
    }

    public void set_id(String _id) {
        this._id = _id;
    }

    public BImage() {
		
	}

//	public BImage(String imageKey) {
//		this( imageKey,  null,null);
//	}
//
//	
//	public BImage(String imageKey, String imageURL) {
//		this( imageKey,  imageURL,null);
//	}
//
//	
//	public BImage(String imageKey, String imageURL, String DOCID) {
//		super();
//		this.imageKey= imageKey;
//		this.imageURL = imageURL;
//		this.DOCID = DOCID;
//	}
	
	   public BImage(String domain, String DOCID,String sourceKey, String sourceURL,String imageKey, String imageURL) {
	        super();
	        this.domain = domain;
	        this.sourceKey = sourceKey;
	        this.sourceURL = sourceURL;
	        this.imageKey= imageKey;
	        this.imageURL = imageURL;
	        this.DOCID = DOCID;
	    }
	
	public boolean check(){
		if(imageKey==null ||"".equals(imageKey) || DOCID==null ||"".equals(DOCID) || imageURL==null ||"".equals(imageURL))
			return false;
		return true;
	}
	
	public String getImageKey() {
		return imageKey;
	}

	public void setImageKey(String imageKey) {
		this.imageKey = imageKey;
	}

	public String getImageURL() {
        return imageURL;
    }

    public void setImageURL(String imageURL) {
        this.imageURL = imageURL;
    }

    public String getDOCID() {
		return DOCID;
	}

	public void setDOCID(String dOCID) {
		DOCID = dOCID;
	}

	public String getStatus() {
	    if(StringUtils.isBlank(status) ){
	        status ="0";
	    }
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((DOCID == null) ? 0 : DOCID.hashCode());
		result = prime * result
				+ ((imageKey == null) ? 0 : imageKey.hashCode());
		result = prime * result
				+ ((imageURL == null) ? 0 : imageURL.hashCode());
		result = prime * result + ((status == null) ? 0 : status.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BImage other = (BImage) obj;
		if (DOCID == null) {
			if (other.DOCID != null)
				return false;
		} else if (!DOCID.equals(other.DOCID))
			return false;
		if (imageKey == null) {
			if (other.imageKey != null)
				return false;
		} else if (!imageKey.equals(other.imageKey))
			return false;
		if (imageURL == null) {
			if (other.imageURL != null)
				return false;
		} else if (!imageURL.equals(other.imageURL))
			return false;
		if (status == null) {
			if (other.status != null)
				return false;
		} else if (!status.equals(other.status))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ImageEntity [imageKey=" + imageKey + ", imageURL="
				+ imageURL + ", DOCID=" + DOCID + ", status=" +
		        status +  ", sourceKey=" +
		        sourceKey+", sourceURL=" +
		                sourceURL+ ", platformId=" +
		        platformId+"]";
	}


	

}
